import request from '@/utils/request'
import Qs from 'qs'

export function listGoods(query) {
	return request.get('/adminSellerGoods/getGoodsListByPage', {
		params: {
			...query
		}
	})
}

export function editGoods(data) {
	return request.post('/adminSellerGoods/updateGoods', {
		...data
	})
}

export function deleteGoods(id) {
	return request.post('/adminSellerGoods/deleteGoods', Qs.stringify({
		id: id,
	}))
}

export function batchDeleteGoods(ids) {
	return request.post('/adminSellerGoods/batchDeleteGoods', Qs.stringify({
		ids: ids,
	}))
}

export function createGoods(data) {
	return request.post('/adminSellerGoods/createGoods', {
		...data
	})
}

export function detailGoods(id) {
	return request.post('/adminSellerGoods/detailGoods', Qs.stringify({
		id: id,
	}))
}

export function upOrDownGoods(ids, status) {
	if (status == "上架") {
		return request.get('/adminSellerGoods/upperGoods', {
			params: {
				id: ids[0]
			}
		})
	} else {
		return request.post('/adminSellerGoods/lowerGoods', {
			id: ids
		})
	}
}
